//****************************************************************************
//
// show timing example
//
//****************************************************************************

#configure board        hu_arm_v4
#configure clcd_lines   2
#configure memory       rom
#configure baudrate     38400

#include "pRTOS.h"

int main( void ){
   RTOS::run();
   return 0;
}

// end of standard part

void show_run_time( void ){
   unsigned int milliseconds = RTOS::run_time() / ( 1 MS );
   std::cout
      << "The RTOS has been running for " 
      << std::dec << std::setfill( '0' )
      << std::setw( 2 ) << ( milliseconds / ( 60 * 60 * 1000 )) % 24 << ":"
      << std::setw( 2 ) << ( milliseconds / ( 60 * 1000 )) % 60 << ":"
      << std::setw( 2 ) << ( milliseconds / 1000 ) % 60 << "."
      << std::setw( 3 ) << milliseconds % 1000
      << std::setfill( ' ' ) << "\n";      
}

class application : public RTOS::task {
   void main( void ){
      for(;;){
         show_run_time();
         sleep( 3333 MS );
      }
   }
};

application application;

